package cn.xi.dao;

import cn.xi.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface OrderDao {
    @Select("select COUNT(*) from t_order where member_id = #{integer} and orderDate = #{orderDate} and setmeal_id = #{setmealId}")
    Integer selectMember(@Param("integer") Integer integer, @Param("orderDate") String orderDate, @Param("setmealId") Integer setmealId);

    @Insert("insert into t_order(member_id,orderDate,orderType,orderStatus,setmeal_id) values (#{memberId},#{orderDate},#{orderType},#{orderStatus},#{setmealId})")
    void save(Order order);

    @Select("select m.name member,s.name setmeal ,o.orderDate orderDate,o.orderType orderType from t_member m ,t_order o ,t_setmeal s where m.id = o.member_id and s.id=o.setmeal_id and o.id=#{id}")
    Order findById(Integer id);
}
